﻿<!DOCTYPE HTML /> 
<%@LANGUAGE="JAVASCRIPT" %>
<!--#include file ="Includes/DB.asp" namespace="DB"-->
<!--#include file ="Includes/JSON2.asp"-->
<!--#include file ="Includes/ASPHelpers.asp" namespace="Helpers"-->
<!--#include file ="AdminScriptManagerModel.asp"-->


<%
	var model = new AdminScriptManagerModel();
	model.Init();

	var print = Helpers.Print;

%>


<html xmlns="http://www.w3.org/1999/xhtml">
<% Response.AddHeader("X-UA-Compatible", "IE=edge"); %>

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>Script Manager</title>
	<link rel="stylesheet" type="text/css" href="Content/Styles/jqueryUI/jquery-ui.css">
	<link rel="stylesheet" type="text/css" href="Content/Styles/AfterHours.css">
	<link rel="stylesheet" type="text/css" href="Content/Styles/AdminScriptManager.css">
	<link rel="stylesheet" type="text/css" href="Content/Styles/jQueryUIOverrides.css" />


</head>



<body>
	<h1>
		Manage Scripts
	</h1>

	<ul id="categories">
		<%
			for (var category in model.Scripts) {

				var currentCategory = model.Scripts[category];

				var scriptsHTML = ["<ul class='scripts'>"];

				for (var scriptIndex in currentCategory) {
					var currentScript = currentCategory[scriptIndex];

					scriptsHTML.push(
						"<li class='script' scriptid='" + currentScript.ScriptID + "' scripttitle='" + currentScript.Title + "'>"
							, "<div class='scriptContainer'>"
								, "<a href='AdminScriptEditor.asp?scriptid=" + currentScript.ScriptID + "'>"
									, currentScript.Title
								, "</a>"
								, "<div class='scriptButtonsContainer'>"
									, "<button class='btnDelete' scriptid='" + currentScript.ScriptID + "'>"
										, "Delete"
									, "</button>"
								, "</div>"
							, "</div>"
						, "</li>"
					);
				}

				scriptsHTML.push("</ul>");


				
				print(
					"<li class='category'>"
						, "<div class='categoryHeader'>"
							, "<span class='generalIcons blueArrowDownIcon collapseExpand'></span>"
							, "<span class='categoryTitle'>"
								, category + ":"
							, "</span>"
						, "</div>"
						, scriptsHTML.join("")
					,"</li>"
				);

			}

		%>
	</ul>


<!-- --------- SCRIPTS ------------------------------------------------------------------------------ -->
	<script src="Content/Scripts/jquery.js" type="text/javascript"></script>
	<script src="Content/Scripts/jquery-ui.js" type="text/javascript"></script>
	<script src="Content/Scripts/AdminScriptManager.js" type="text/javascript"></script>
	<script src="Content/Scripts/jQueryExtensions.js" type="text/javascript"></script>
</body>
</html>
